<template>
  <div class="content">
    <div class="header">
      <i class="iconfont icon-qianjin-copy" @click="iconClick"></i>
      取现中
    </div>
    <img class="img" :src="imgSrc" alt="">
    <div class="title">{{mesg}}</div>
    <div class="btn" v-if="code==000">
      <div class="btn-left" @click="repayAgain">再取一次</div>
      <div class="btn-right" @click="details">查看详情</div>
    </div>
    <div class="btn" v-else>
      <div class="again" @click="repayAgain">再取一次</div>
    </div>
  </div>
</template>

<script>
import Vue from 'vue'
import '../../../js/lib/flexble.js'
import commons from '../../../common/js/common.js'
import Top from 'components/Header/Header'
import { Indicator, MessageBox, TabContainer, TabContainerItem  } from "mint-ui";
export default {
  name: 'repayStatus',
  components: { Top },
  data() {
    return {
      methodList: [],
      headTitle: '',
      code:commons.getParameter('code'),
      mesg:'',
      imgSrc:'../static/img/repaySuccess.png',
      failMsg:commons.getParameter('mesg')
    }
  },
  mounted(){
    Vue.http.interceptors.push((request, next) => { //请求拦截器
      //请求前
      request.headers.set('token', commons.getCookie('token')); //设置请求头
      Indicator.open('加载中...'); //请求loading
      next((response) => {
        //请求后
        Indicator.close(); //隐藏loading
        return response
      })
    })
    if(this.code=='000'){
      this.mesg='交易成功';
      this.imgSrc='../static/img/repaySuccess.png';
    }else if(this.code=='001'){
      this.mesg='交易处理中';
      this.imgSrc='../static/img/repayIng.png';
    }else if(this.code=='111'){
      this.mesg='交易失败（'+this.failMsg+'）';
      this.imgSrc='../static/img/repayFail.png';
    }else if(this.code=='222'){
      this.mesg='交易异常';
    }
    window.sessionStorage.setItem('canClick','');
    window.sessionStorage.setItem('isShow','');
    window.sessionStorage.setItem('shouTogetchashObj','');
  },
  methods: {
    iconClick(){//去首页
      // this.$router.push({ path: '/main/home'});
      window.location.href=commons.paths;
    },
    //再取一次
    repayAgain(){
      // this.$router.push({ path: '/main/mine/enchash/getMoney'});
      window.location.href='./getMoney.html';
    },
    //查看详情
    details(){
      // this.$router.push({ path: '/main/mine/enchash/chashDetails',query: {order_no:this.$route.query.order_no} });
      window.location.href='./chashDetails.html?order_no='+commons.getParameter('order_no');
    }
    
  }
}
</script>
<style lang="scss" scoped>
@import '../../../scss/base.scss';
body{
  background:#fff;
}
.header {
    background: -webkit-linear-gradient(bottom, #2ce9e8, #7dd7ff);
    position: fixed;
    top: 0;
    z-index: 10;
    width: 100%;
    height: 1.2rem;
    // background: $primaryColor;
    color: #fff;
    text-align: center;
    font-size: 0.42rem;
    line-height: 1.2rem;
    .icon-qianjin-copy {
        position: absolute;
        left: 0.4rem;
        color: #fff;
    }
    .right{
      position: absolute;
      right: 0.4rem;
      top:0;
      font-size: 0.4rem;
    }
    
}
.img{
  display: block;
  width: 6.4rem;
  margin:0 auto;
  margin-top: 1.2rem;
}
.title{
  margin-top:0.346rem;
  color:#333;
  font-size: 0.45333rem;
}
.btn{
  margin:0 auto;
  margin-top: 1.6rem;
  width: 7.7rem;
  height: 1.17rem;
  .btn-left{
    float: left;
    width: 3.4rem;
    height: 1.17rem;
    line-height: 1.17rem;
    border:1px solid #00dada;
    color: #00dada;
    font-size: 0.45rem;
    border-radius: 0.15rem;
  }
  .btn-right{
    float: right;
    width: 3.4rem;
    height: 1.17rem;
    line-height: 1.17rem;
    font-size: 0.45rem;
    border-radius: 0.15rem;
    background-color: #00dada;
    color: #fff;
  }
  .again{
    width: 100%;
    height: 1.17rem;
    line-height: 1.17rem;
    font-size: 0.45rem;
    border-radius: 0.15rem;
    background-color: #00dada;
    color: #fff;
  }
}

</style>
